import java.lang.Math;

import javax.sound.sampled.AudioSystem;
import javax.sound.sampled.AudioFormat;
import javax.sound.sampled.DataLine;
import javax.sound.sampled.SourceDataLine;
import javax.sound.sampled.LineUnavailableException;

import javax.swing.*;




public class JKochMorse{

    public static void main(String[] args)
    {
	/*	SourceDataLine line = null;
	AudioFormat format;
	format = new AudioFormat((float)22050, 16, 1, true, false); 

	DataLine.Info info = new DataLine.Info(SourceDataLine.class, format);
	
	if(! AudioSystem.isLineSupported(info)){
	    System.err.println("Can not open sound output...");
	    System.exit(1);
	}
	
	try {
	    line = (SourceDataLine) AudioSystem.getLine(info);
	    line.open(format);
	    line.start();
	} catch (LineUnavailableException err) {
	    System.err.println("Oops, can not open line even though supported...");
	    System.exit(1);
	}

	
	double f=800.0;
	double dt = 1.0/22050;
	int N = 1*44100;

	byte[] buffer = new byte[N];
	for(int i=0; i<N; i += 2){
	    int val = (int)Math.floor(32000.0 * Math.sin(2.0*Math.PI*f*(i*dt)));
	    buffer[i] = (byte)(val);
	    buffer[i+1] = (byte)(val>>8);
	}

	line.write(buffer, 0, N);

	line.drain();
	line.close();

	
	System.exit(0); */

	Runnable guiCreator = new Runnable() {
		public void run() {
		    JFrame frame = new JFrame("Koch Morse Tutor");
		    
		    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		    
		    JTextArea text = new JTextArea("done.");
		    text.setEditable(false);
		    frame.getContentPane().add(text);
		    
		    frame.setSize(300,200);
		    frame.setVisible(true);
		}
	    };

	
	SwingUtilities.invokeLater(guiCreator);
    } 
}
